#create function to save figures
savefig <- function(plotobject, filename, filepath = "output/figures/", width = 6.5, height, dpi = 300, scale = 1.5, device = "pdf", extension = ".pdf") {
  require(ggplot2)
  ggplot2::ggsave(
    filename = paste0(filepath, filename, extension),
    plot = plotobject,
    width = width,
    height = height,
    dpi = dpi,
    scale = scale,
    device = device
  )
}